

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;

//TODO:[au] write a contract to the class
//TODO: ������, �������� - ��� ������� ����� �������� ��� ������ ��� �� �������
/**
 *
 *
 */
public class ChatAuthentification {
	private File path = new File("uins.txt");
	
	public boolean autentificate(String login, String password) {
		
		String userName;
		boolean access = false;
		LineNumberReader reader;
		try {
			reader = new LineNumberReader(new FileReader(path.getAbsolutePath()));
			while (((userName = reader.readLine()) != null) && !access) {
				if (userName.equals(login + " " + password))
					access = true;	
			}
			reader.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}	
			
		return access;
	}
	
}
